package org.sja.log2traffic.dataStructures;

public class ResultValue {

	private String valueAsString;
	private Long valueAsLong;
	private Double valueAsDouble;
	
	public ResultValue(String valueAsString, Long valueAsLong) {
		this.valueAsString = valueAsString;
		this.valueAsLong = valueAsLong;
		this.valueAsDouble = Double.valueOf(valueAsLong);
	}

	public ResultValue(String valueAsString, Double valueAsDouble) {
		this.valueAsString = valueAsString;
		this.valueAsLong = valueAsDouble.longValue();
		this.valueAsDouble = valueAsDouble;
	}	
	
	public String getValueAsString() {
		return valueAsString;
	}

	public Long getValueAsLong() {
		return valueAsLong;
	}

	public Double getValueAsDouble() {
		return valueAsDouble;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((valueAsString == null) ? 0 : valueAsString.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ResultValue other = (ResultValue) obj;
		if (valueAsString == null) {
			if (other.valueAsString != null)
				return false;
		} else if (!valueAsString.equals(other.valueAsString))
			return false;
		return true;
	}
	
	
	
}
